#ifndef __DALELIB_CAMERA_H__
#define __DALELIB_CAMERA_H__

#include <dalelib/graphics.h>
#include <dalelib/maths.h>

namespace dalelib
{

class Camera
{
private:

	bool _is_ortho;

	v3 _pos;
	quat _ang;

	m4 _modelview;
	m4 _modelview_inv;
	m4 _projection;

	float _fov;
	float _aspect;
	float _near;
	float _far;
	float _left;
	float _right;
	float _top;
	float _bottom;

public:

	Camera()
		: _is_ortho(true)
		, _pos(v3(0,0,-1))
		, _ang(quat(1,0,0,0))
		, _near(1.f)
		, _far(1000.f)
		, _left(-1.f)
		, _right(1.f)
		, _top(1.f)
		, _bottom(-1.f)
	{ }

	v3& getPos() { return _pos; }
	quat& getAng() { return _ang; }
	m4& getModelView();
	m4& getModelViewInv();
	m4& getProjection();
	m4 getModelViewProj();
	float getFOV() { return _fov; }
	void setPerspective(const float _Fov, const float _Aspect, const float _Near, const float _Far);
	void setOrtho(const float _Left, const float _Right, const float _Top, const float _Bottom, const float _Near, const float _Far);
	void setModelViewIdentity();
	void lookAt(const v3 _Pos, const v3 _Tgt, const v3 _Up);
	void rotate(const v3 _Axis, const float _Angle);
	void view();
	void viewBoundingSphere(const v3 _Tgt,const float _Size,const float _DepthRange=100.f);


};

} // namespace dalelib

#endif
